home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1999 July: Mac OS SDK / Dev.CD Jul 99 SDK1.toast / Development Kits / Mac OS / Interfaces&Libraries / Universal / Interfaces / CIncludes / ATA.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-08-17  |  54.7 KB  |  1,065 lines  |  [TEXT/MPS ]

  1. /*
  2.      File:        ATA.h
  3.  
  4.      Contains:    ATA (PC/AT Attachment) Interfaces
  5.  
  6.      Version:    Technology:    System 7.5
  7.                  Release:    Universal Interfaces 3.2
  8.  
  9.      Copyright:    © 1995-1998 by Apple Computer, Inc., all rights reserved
  10.  
  11.      Bugs?:        For bug reports, consult the following page on
  12.                  the World Wide Web:
  13.  
  14.                      http://developer.apple.com/bugreporter/
  15.  
  16. */
  17. #ifndef __ATA__
  18. #define __ATA__
  19.  
  20. #ifndef __MACTYPES__
  21. #include <MacTypes.h>
  22. #endif
  23. #ifndef __MIXEDMODE__
  24. #include <MixedMode.h>
  25. #endif
  26.  
  27.  
  28.  
  29. #if PRAGMA_ONCE
  30. #pragma once
  31. #endif
  32.  
  33. #ifdef __cplusplus
  34. extern "C" {
  35. #endif
  36.  
  37. #if PRAGMA_IMPORT
  38. #pragma import on
  39. #endif
  40.  
  41. #if PRAGMA_STRUCT_ALIGN
  42.     #pragma options align=mac68k
  43. #elif PRAGMA_STRUCT_PACKPUSH
  44.     #pragma pack(push, 2)
  45. #elif PRAGMA_STRUCT_PACK
  46.     #pragma pack(2)
  47. #endif
  48.  
  49.  
  50. /* This is the structure used for the AT Interface core routines below */
  51.  
  52. enum {
  53.     kATATrap                    = 0xAAF1,                        /* Manager trap number <This should be defined in Traps.h>*/
  54.     kATAPBVers1                    = 0x01,                            /* parameter block version number 1*/
  55.     kATAPBVers2                    = 0x02,                            /* parameter block version number for structures*/
  56.     kATAPBVers3                    = 0x03,                            /* parameter block version for ATA times*/
  57.     kATADefaultBlockSize        = 512                            /* default block size*/
  58. };
  59.  
  60. /* Used to determine the presence of traps*/
  61.  
  62. enum {
  63.     kFSMTrap                    = 0xAC,
  64.     mDQEChanged                    = 1                                /* DQE has changed */
  65. };
  66.  
  67. /* Task file definition ••• Error Register •••*/
  68.  
  69. enum {
  70.     bATABadBlock                = 7,                            /* bit number of bad block error bit*/
  71.     bATAUncorrectable            = 6,                            /* bit number of uncorrectable error bit*/
  72.     bATAMediaChanged            = 5,                            /* bit number of media changed indicator*/
  73.     bATAIDNotFound                = 4,                            /* bit number of ID not found error bit*/
  74.     bATAMediaChangeReq            = 3,                            /* bit number of media changed request*/
  75.     bATACommandAborted            = 2,                            /* bit number of command abort bit*/
  76.     bATATrack0NotFound            = 1,                            /* bit number of track not found*/
  77.     bATAAddressNotFound            = 0,                            /* bit number of address mark not found*/
  78.     mATABadBlock                = 1 << bATABadBlock,            /* Bad Block Detected*/
  79.     mATAUncorrectable            = 1 << bATAUncorrectable,        /* Uncorrectable Data Error*/
  80.     mATAMediaChanged            = 1 << bATAMediaChanged,        /* Media Changed Indicator (for removable)*/
  81.     mATAIDNotFound                = 1 << bATAIDNotFound,            /* ID Not Found*/
  82.     mATAMediaChangeReq            = 1 << bATAMediaChangeReq,        /* Media Change Requested (NOT IMPLEMENTED)*/
  83.     mATACommandAborted            = 1 << bATACommandAborted,        /* Aborted Command*/
  84.     mATATrack0NotFound            = 1 << bATATrack0NotFound,        /* Track 0 Not Found*/
  85.     mATAAddressNotFound            = 1 << bATAAddressNotFound        /* Address Mark Not Found*/
  86. };
  87.  
  88. /* Task file definition ••• Features register •••*/
  89.  
  90. enum {
  91.     bATAPIuseDMA                = 0,                            /* bit number of useDMA bit (ATAPI)*/
  92.     mATAPIuseDMA                = 1 << bATAPIuseDMA
  93. };
  94.  
  95. /* Task file definition ••• ataTFSDH Register •••*/
  96.  
  97. enum {
  98.     mATAHeadNumber                = 0x0F,                            /* Head Number (bits 0-3) */
  99.     mATASectorSize                = 0xA0,                            /* bit 7=1; bit 5 = 01 (512 sector size) <DP4>*/
  100.     mATADriveSelect                = 0x10,                            /* Drive (0 = master, 1 = slave) */
  101.     mATALBASelect                = 0x40                            /* LBA mode bit (0 = chs, 1 = LBA)*/
  102. };
  103.  
  104. /* Task file definition ••• Status Register •••*/
  105.  
  106. enum {
  107.     bATABusy                    = 7,                            /* bit number of BSY bit*/
  108.     bATADriveReady                = 6,                            /* bit number of drive ready bit*/
  109.     bATAWriteFault                = 5,                            /* bit number of write fault bit*/
  110.     bATASeekComplete            = 4,                            /* bit number of seek complete bit*/
  111.     bATADataRequest                = 3,                            /* bit number of data request bit*/
  112.     bATADataCorrected            = 2,                            /* bit number of data corrected bit*/
  113.     bATAIndex                    = 1,                            /* bit number of index mark*/
  114.     bATAError                    = 0,                            /* bit number of error bit*/
  115.     mATABusy                    = 1 << bATABusy,                /* Unit is busy*/
  116.     mATADriveReady                = 1 << bATADriveReady,            /* Unit is ready*/
  117.     mATAWriteFault                = 1 << bATAWriteFault,            /* Unit has a write fault condition*/
  118.     mATASeekComplete            = 1 << bATASeekComplete,        /* Unit seek complete*/
  119.     mATADataRequest                = 1 << bATADataRequest,            /* Unit data request*/
  120.     mATADataCorrected            = 1 << bATADataCorrected,        /* Data corrected*/
  121.     mATAIndex                    = 1 << bATAIndex,                /* Index mark - NOT USED*/
  122.     mATAError                    = 1 << bATAError                /* Error condition - see error register*/
  123. };
  124.  
  125. /* Task file definition ••• Device Control Register •••*/
  126.  
  127. enum {
  128.     bATADCROne                    = 3,                            /* bit number of always one bit*/
  129.     bATADCRReset                = 2,                            /* bit number of reset bit*/
  130.     bATADCRnIntEnable            = 1,                            /* bit number of interrupt disable*/
  131.     mATADCROne                    = 1 << bATADCROne,                /* always one bit*/
  132.     mATADCRReset                = 1 << bATADCRReset,            /* Reset (1 = reset)*/
  133.     mATADCRnIntEnable            = 1 << bATADCRnIntEnable        /* Interrupt Disable(0 = enabled)*/
  134. };
  135.  
  136. /* ATA Command Opcode definition*/
  137.  
  138. enum {
  139.     kATAcmdWORetry                = 0x01,                            /* Without I/O retry option*/
  140.     kATAcmdNOP                    = 0x0000,                        /* NOP operation - media detect*/
  141.     kATAcmdRecal                = 0x0010,                        /* Recalibrate command */
  142.     kATAcmdRead                    = 0x0020,                        /* Read command */
  143.     kATAcmdReadLong                = 0x0022,                        /* Read Long command*/
  144.     kATAcmdWrite                = 0x0030,                        /* Write command */
  145.     kATAcmdWriteLong            = 0x0032,                        /* Write Long*/
  146.     kATAcmdWriteVerify            = 0x003C,                        /* Write verify*/
  147.     kATAcmdReadVerify            = 0x0040,                        /* Read Verify command */
  148.     kATAcmdFormatTrack            = 0x0050,                        /* Format Track command */
  149.     kATAcmdSeek                    = 0x0070,                        /* Seek command */
  150.     kATAcmdDiagnostic            = 0x0090,                        /* Drive Diagnostic command */
  151.     kATAcmdInitDrive            = 0x0091,                        /* Init drive parameters command */
  152.     kATAcmdReadMultiple            = 0x00C4,                        /* Read multiple*/
  153.     kATAcmdWriteMultiple        = 0x00C5,                        /* Write multiple*/
  154.     kATAcmdSetRWMultiple        = 0x00C6,                        /* Set Multiple for Read/Write Multiple*/
  155.     kATAcmdReadDMA                = 0x00C8,                        /* Read DMA (with retries)*/
  156.     kATAcmdWriteDMA                = 0x00CA,                        /* Write DMA (with retries)*/
  157.     kATAcmdMCAcknowledge        = 0x00DB,                        /* Acknowledge media change - removable*/
  158.     kATAcmdDoorLock                = 0x00DE,                        /* Door lock*/
  159.     kATAcmdDoorUnlock            = 0x00DF,                        /* Door unlock*/
  160.     kATAcmdStandbyImmed            = 0x00E0,                        /* Standby Immediate*/
  161.     kATAcmdIdleImmed            = 0x00E1,                        /* Idle Immediate*/
  162.     kATAcmdStandby                = 0x00E2,                        /* Standby*/
  163.     kATAcmdIdle                    = 0x00E3,                        /* Idle*/
  164.     kATAcmdReadBuffer            = 0x00E4,                        /* Read sector buffer command */
  165.     kATAcmdCheckPowerMode        = 0x00E5,                        /* Check power mode command    <04/04/94>*/
  166.     kATAcmdSleep                = 0x00E6,                        /* Sleep*/
  167.     kATAcmdWriteBuffer            = 0x00E8,                        /* Write sector buffer command */
  168.     kATAcmdWriteSame            = 0x00E9,                        /* Write same data to multiple sectors*/
  169.     kATAcmdDriveIdentify        = 0x00EC,                        /* Identify Drive command */
  170.     kATAcmdMediaEject            = 0x00ED,                        /* Media Eject*/
  171.     kATAcmdSetFeatures            = 0x00EF                        /* Set Features*/
  172. };
  173.  
  174. /* Set feature command opcodes*/
  175.  
  176. enum {
  177.     kATAEnableWriteCache        = 0x02,                            /*        Enable write cache*/
  178.     kATASetTransferMode            = 0x03,                            /*        Set transfer mode*/
  179.     kATASetPIOMode                = 0x08,                            /*        PIO Flow Control Tx Mode bit*/
  180.     kATAEnableECC                = 0x88,                            /*        ECC enable*/
  181.     kATAEnableRetry                = 0x99,                            /*        Retry enable*/
  182.     kATAEnableReadAhead            = 0xAA                            /*        Read look-ahead enable*/
  183. };
  184.  
  185. /*
  186.   --------------------------------------------------------------------------------
  187.    enums for dealing with device IDs
  188. */
  189.  
  190.  
  191. enum {
  192.     kATABusIDMask                = 0x000000FF,
  193.     kATADeviceIDMask            = 0x0000FF00,
  194.     kATADeviceIDClippingMask    = 0x0000FFFF,
  195.     kMinBusID                    = 0x00000000,
  196.     kMaxBusID                    = 0x000000FE
  197. };
  198.  
  199.  
  200. enum {
  201.     kATAStartIterateDeviceID    = 0xFFFF,
  202.     kATAEndIterateDeviceID        = 0xFF
  203. };
  204.  
  205. /*--------------------------------------------------------------------------------*/
  206. /* Device Register Images  (8 bytes) */
  207.  
  208. struct ataTaskFile {
  209.     UInt8                             ataTFFeatures;                /* <-> Error(R) or ataTFFeatures(W) register image */
  210.     UInt8                             ataTFCount;                    /* <-> Sector count/remaining */
  211.     UInt8                             ataTFSector;                /* <-> Sector start/finish */
  212.     UInt8                             ataTFReserved;                /* reserved                    */
  213.     UInt16                             ataTFCylinder;                /* <-> ataTFCylinder (Big endian) */
  214.     UInt8                             ataTFSDH;                    /* <-> ataTFSDH register image*/
  215.     UInt8                             ataTFCommand;                /* <-> Status(R) or Command(W) register image */
  216. };
  217. typedef struct ataTaskFile                ataTaskFile;
  218. /* ATA Manager Function Code Definition*/
  219.  
  220. enum {
  221.     kATAMgrNOP                    = 0x00,                            /* No Operation*/
  222.     kATAMgrExecIO                = 0x01,                            /* Execute ATA I/O*/
  223.     kATAMgrBusInquiry            = 0x03,                            /* Bus Inquiry*/
  224.     kATAMgrQRelease                = 0x04,                            /* I/O Queue Release*/
  225.     kATAMgrAbort                = 0x10,                            /* Abort command*/
  226.     kATAMgrBusReset                = 0x11,                            /* Reset ATA bus*/
  227.     kATAMgrRegAccess            = 0x12,                            /* Register Access*/
  228.     kATAMgrDriveIdentify        = 0x13,                            /* Drive Identify            <DP03/10/94>*/
  229.     kATAMgrDriverLoad            = 0x82,                            /* Load driver from either Media, ROM, etc.*/
  230.     kATAMgrDriveRegister        = 0x85,                            /* Register a driver        <4/18/94>*/
  231.     kATAMgrFindDriverRefnum        = 0x86,                            /* lookup a driver refnum    <4/18/94>*/
  232.     kATAMgrRemoveDriverRefnum    = 0x87,                            /* De-register a driver    <4/18/94>*/
  233.     kATAMgrModifyEventMask        = 0x88,                            /* Modify driver event mask*/
  234.     kATAMgrDriveEject            = 0x89,                            /* Eject the drive        <8/1/94>*/
  235.     kATAMgrGetDrvConfiguration    = 0x8A,                            /* Get device configuration    <8/6/94>*/
  236.     kATAMgrSetDrvConfiguration    = 0x8B,                            /* Set device configuration <8/6/94>*/
  237.     kATAMgrGetLocationIcon        = 0x8C,                            /* Get card location icon    <SM4>*/
  238.     kATAMgrManagerInquiry        = 0x90,                            /* Manager Inquiry*/
  239.     kATAMgrManagerInit            = 0x91,                            /* Manager initialization*/
  240.     kATAMgrManagerShutdown        = 0x92,                            /* Manager ShutDown*/
  241.                                                                 /* note: functions 0x93 to 0x97 are reserved*/
  242.     kATAMgrFindSpecialDriverRefnum = 0x98,                        /* lookup a driver refnum; driverloader,notify-all or ROM driver.*/
  243.     kATAMgrNextAvailable        = 0x99
  244. };
  245.  
  246. /* used in the ataDrvrFlags field for kATAMgrDriveRegister,kATAMgrRemoveDriverRefnum & kATAMgrFindSpecialDriverRefnum*/
  247.  
  248. enum {
  249.     kATANotifyAllDriver            = 0,                            /* Notify-All driver*/
  250.     kATADriverLoader            = 1,                            /* Driver loader driver        */
  251.     kATAROMDriver                = 2                                /* ROM driver*/
  252. };
  253.  
  254. /* 'ATAFlags' field of the PB header definition*/
  255.  
  256. enum {
  257.     bATAFlagUseConfigSpeed        = 15,                            /* bit number of use default speed flag*/
  258.     bATAFlagByteSwap            = 14,                            /* bit number of byte swap flag*/
  259.     bATAFlagIORead                = 13,                            /* bit number of I/O read flag*/
  260.     bATAFlagIOWrite                = 12,                            /* bit number of I/O write flag*/
  261.     bATAFlagImmediate            = 11,                            /* bit number of immediate flag*/
  262.     bATAFlagQLock                = 10,                            /* bit number of que lock on error*/
  263.     bATAFlagReserved1            = 9,                            /* reserved*/
  264.     bATAFlagUseScatterGather    = 8,                            /* bit numbers of scatter gather*/
  265.     bATAFlagUseDMA                = 7,                            /* bit number of use DMA flag*/
  266.     bATAFlagProtocolATAPI        = 5,                            /* bit number of ATAPI protocol*/
  267.     bATAFlagReserved2            = 4,                            /* reserved*/
  268.     bATAFlagTFRead                = 3,                            /* bit number of register update*/
  269.     bATAFlagLEDEnable            = 0,                            /* bit number of LED enable*/
  270.     mATAFlagUseConfigSpeed        = 1 << bATAFlagUseConfigSpeed,
  271.     mATAFlagByteSwap            = 1 << bATAFlagByteSwap,        /* Swap data bytes (read - after; write - before)*/
  272.     mATAFlagIORead                = 1 << bATAFlagIORead,            /* Read (in) operation*/
  273.     mATAFlagIOWrite                = 1 << bATAFlagIOWrite,            /* Write (out) operation*/
  274.     mATAFlagImmediate            = 1 << bATAFlagImmediate,        /* Head of Que; Immediate operation*/
  275.     mATAFlagQLock                = 1 << bATAFlagQLock,            /* Manager queue lock on error (freeze the queue)*/
  276.     mATAFlagUseScatterGather    = 1 << bATAFlagUseScatterGather, /* Scatter gather enable*/
  277.     mATAFlagUseDMA                = 1 << bATAFlagUseDMA,
  278.     mATAFlagProtocolATAPI        = 1 << bATAFlagProtocolATAPI,    /* ATAPI protocol indicator*/
  279.     mATAFlagTFRead                = 1 << bATAFlagTFRead,            /* update reg block request upon detection of an error*/
  280.     mATAFlagLEDEnable            = 1 << bATAFlagLEDEnable        /* socket LED enable*/
  281. };
  282.  
  283. /* These are legacy ATAFlags definitions, which will go away in the future*/
  284.  
  285. enum {
  286.     bATAFlagScatterGather1        = bATAFlagReserved1,            /* 9*/
  287.     bATAFlagScatterGather0        = bATAFlagUseScatterGather,        /* 8*/
  288.     bATAFlagProtocol1            = bATAFlagProtocolATAPI,        /* 5*/
  289.     bATAFlagProtocol0            = bATAFlagReserved2,            /* 4*/
  290.     mATAFlagScatterGather1        = 1 << bATAFlagScatterGather1,
  291.     mATAFlagScatterGather0        = mATAFlagUseScatterGather,
  292.     mATAFlagScatterGathers        = mATAFlagScatterGather1 + mATAFlagScatterGather0,
  293.     mATAFlagProtocol1            = mATAFlagProtocolATAPI,
  294.     mATAFlagProtocol0            = 1 << bATAFlagProtocol0,
  295.     mATAFlagProtocols            = mATAFlagProtocol1 + mATAFlagProtocol0
  296. };
  297.  
  298.  
  299. struct ataPBHeader {
  300.                                                                 /* Start of cloned common header ataPBHdr */
  301.     struct ataPBHeader *            ataPBLink;                    /* a pointer to the next entry in the queue    */
  302.     UInt16                             ataPBQType;                    /* type byte for safety check*/
  303.     UInt8                             ataPBVers;                    /* -->: parameter block version number*/
  304.     UInt8                             ataPBReserved;                /* Reserved                                        */
  305.     Ptr                             ataPBReserved2;                /* Reserved                                        */
  306.     ProcPtr                         ataPBCallbackPtr;            /* -->: Completion Routine Pointer    */
  307.     OSErr                             ataPBResult;                /* <--: Returned result                */
  308.     UInt8                             ataPBFunctionCode;            /* -->: Manager Function Code */
  309.     UInt8                             ataPBIOSpeed;                /* -->: I/O Timing Class            */
  310.     UInt16                             ataPBFlags;                    /* -->: Various control options    */
  311.     SInt16                             ataPBReserved3;                /* Reserved                                        */
  312.     UInt32                             ataPBDeviceID;                /* -->: Device identifier            */
  313.     UInt32                             ataPBTimeOut;                /* -->: Transaction timeout value    in msec */
  314.     Ptr                             ataPBClientPtr1;            /* Client's storage Ptr 1     */
  315.     Ptr                             ataPBClientPtr2;            /* Client's storage Ptr 2     */
  316.     UInt16                             ataPBState;                    /* Reserved for Manager; Initialize to 0 */
  317.     UInt16                             ataPBSemaphores;            /* Used internally by the manager*/
  318.     SInt32                             ataPBReserved4;                /* Reserved                                        */
  319.                                                                 /* End of cloned common header ataPBHdr*/
  320. };
  321. typedef struct ataPBHeader                ataPBHeader;
  322. /* data request entry structure (16 bytes)*/
  323.  
  324. struct IOBlock {
  325.     UInt8 *                            ataPBBuffer;                /* -->: Data buffer pointer*/
  326.     UInt32                             ataPBByteCount;                /* -->: Data transfer length in bytes*/
  327. };
  328. typedef struct IOBlock                    IOBlock;
  329. /*
  330.    For ATAPI devices the ExtendedPB field is a pointer to the Command Packet
  331.    record which exists of an array of words structured as follows…    <06/15/94>
  332. */
  333.  
  334. struct ATAPICmdPacket {
  335.     SInt16                             atapiPacketSize;            /* Size of command packet in bytes    <06/15/94>*/
  336.     SInt16                             atapiCommandByte[8];        /* The command packet itself    <06/15/94>*/
  337. };
  338. typedef struct ATAPICmdPacket            ATAPICmdPacket;
  339. /* Manager parameter block structure (96 bytes)*/
  340.  
  341. struct ataIOPB {
  342.                                                                 /* Start of cloned common header ataPBHdr*/
  343.     ataPBHeader *                    ataPBLink;                    /* a pointer to the next entry in the queue    */
  344.     UInt16                             ataPBQType;                    /* type byte for safety check*/
  345.     UInt8                             ataPBVers;                    /* -->: parameter block version number; Must be 0x01*/
  346.     UInt8                             ataPBReserved;                /* Reserved                                        */
  347.     Ptr                             ataPBReserved2;                /* Reserved                                        */
  348.     ProcPtr                         ataPBCallbackPtr;            /* -->: Completion Routine Pointer    */
  349.     OSErr                             ataPBResult;                /* <--: Returned result                */
  350.     UInt8                             ataPBFunctionCode;            /* -->: Manager Function Code */
  351.     UInt8                             ataPBIOSpeed;                /* -->: I/O Timing Class            */
  352.     UInt16                             ataPBFlags;                    /* -->: Various control options    */
  353.     SInt16                             ataPBReserved3;                /* Reserved                                        */
  354.     UInt32                             ataPBDeviceID;                /* -->: Device identifier            */
  355.     UInt32                             ataPBTimeOut;                /* -->: Transaction timeout value    in msec */
  356.     Ptr                             ataPBClientPtr1;            /* Client's storage Ptr 1     */
  357.     Ptr                             ataPBClientPtr2;            /* Client's storage Ptr 2     */
  358.     UInt16                             ataPBState;                    /* Reserved for Manager; Initialize to 0 */
  359.     UInt16                             ataPBSemaphores;            /* Used internally by the manager*/
  360.     SInt32                             ataPBReserved4;                /* Reserved                                        */
  361.                                                                 /* End of cloned common header ataPBHdr*/
  362.     SInt8                             ataPBStatusRegister;        /* <--: Last ATA status image*/
  363.     SInt8                             ataPBErrorRegister;            /* <--: Last ATA error image-valid if lsb of Status set*/
  364.     SInt16                             ataPBReserved5;                /* Reserved*/
  365.     UInt32                             ataPBLogicalBlockSize;        /* -->: Blind transfer size per interrupt (Logical block size)*/
  366.     UInt8 *                            ataPBBuffer;                /* -->: Data buffer pointer*/
  367.     UInt32                             ataPBByteCount;                /* -->: Data transfer length in bytes*/
  368.     UInt32                             ataPBActualTxCount;            /* <--: Actual transfer count*/
  369.     UInt32                             ataPBReserved6;                /* Reserved*/
  370.     ataTaskFile                     ataPBTaskFile;                /* <->:    Device register images*/
  371.     ATAPICmdPacket *                ataPBPacketPtr;                /* -->: ATAPI packet command block pointer (valid with ATAPI bit set)*/
  372.     SInt16                             ataPBReserved7[6];            /* Reserved for future expansion*/
  373. };
  374. typedef struct ataIOPB                    ataIOPB;
  375. /* Parameter block structure for bus and Manager inquiry command*/
  376. /* Manager parameter block structure*/
  377.  
  378. struct ataBusInquiry {
  379.                                                                 /* Start of cloned common header ataPBHdr*/
  380.     ataPBHeader *                    ataPBLink;                    /* a pointer to the next entry in the queue    */
  381.     UInt16                             ataPBQType;                    /* type byte for safety check*/
  382.     UInt8                             ataPBVers;                    /* -->: parameter block version number; Must be 0x01*/
  383.     UInt8                             ataPBReserved;                /* Reserved                                        */
  384.     Ptr                             ataPBReserved2;                /* Reserved                                        */
  385.     ProcPtr                         ataPBCallbackPtr;            /* -->: Completion Routine Pointer    */
  386.     OSErr                             ataPBResult;                /* <--: Returned result                */
  387.     UInt8                             ataPBFunctionCode;            /* -->: Manager Function Code */
  388.     UInt8                             ataPBIOSpeed;                /* -->: I/O Timing Class            */
  389.     UInt16                             ataPBFlags;                    /* -->: Various control options    */
  390.     SInt16                             ataPBReserved3;                /* Reserved                                        */
  391.     UInt32                             ataPBDeviceID;                /* -->: Device identifier            */
  392.     UInt32                             ataPBTimeOut;                /* -->: Transaction timeout value    in msec */
  393.     Ptr                             ataPBClientPtr1;            /* Client's storage Ptr 1     */
  394.     Ptr                             ataPBClientPtr2;            /* Client's storage Ptr 2     */
  395.     UInt16                             ataPBState;                    /* Reserved for Manager; Initialize to 0 */
  396.     UInt16                             ataPBSemaphores;            /* Used internally by the manager*/
  397.     SInt32                             ataPBReserved4;                /* Reserved                                        */
  398.                                                                 /* End of cloned common header ataPBHdr*/
  399.     UInt16                             ataEngineCount;                /* <--: TBD; zero for now*/
  400.     UInt16                             ataReserved1;                /* Reserved*/
  401.     UInt32                             ataDataTypes;                /* <--: TBD; zero for now*/
  402.     UInt16                             ataIOpbSize;                /* <--: Size of ATA IO PB*/
  403.     UInt16                             ataMaxIOpbSize;                /* <--: TBD; zero for now*/
  404.     UInt32                             ataFeatureFlags;            /* <--: TBD*/
  405.     UInt8                             ataVersionNum;                /* <--: Version number for the HBA*/
  406.     UInt8                             ataHBAInquiry;                /* <--: TBD; zero for now*/
  407.     UInt16                             ataReserved2;                /* Reserved*/
  408.     UInt32                             ataHBAPrivPtr;                /* <--: Ptr to HBA private data area*/
  409.     UInt32                             ataHBAPrivSize;                /* <--: Size of HBA private data area*/
  410.     UInt32                             ataAsyncFlags;                /* <--: Event capability for callback*/
  411.     UInt8                             ataPIOModes;                /* <--: PIO modes supported (bit-significant)*/
  412.     UInt8                             ataUltraDMAModes;            /* <--: Ultra DMA modes supported (b-sig)*/
  413.     UInt8                             ataSingleDMAModes;            /* <--: Single Word DMA modes supported (b-sig)    */
  414.     UInt8                             ataMultiDMAModes;            /* <--: Multiword DMA modes supported (b-sig)*/
  415.     UInt32                             ataReserved4[4];            /* Reserved*/
  416.     SInt8                             ataReserved5[16];            /* TBD*/
  417.     SInt8                             ataHBAVendor[16];            /* <--: Vendor ID of the HBA*/
  418.     SInt8                             ataContrlFamily[16];        /* <--: Family of ATA Controller*/
  419.     SInt8                             ataContrlType[16];            /* <--: Model number of controller*/
  420.     SInt8                             ataXPTversion[4];            /* <--: version number of XPT*/
  421.     SInt8                             ataReserved6[4];            /* Reserved*/
  422.     NumVersion                         ataHBAversion;                /* <--: version number of HBA*/
  423.     UInt8                             ataHBAslotType;                /* <--: type of slot*/
  424.     UInt8                             ataHBAslotNum;                /* <--: slot number of the HBA*/
  425.     UInt16                             ataReserved7;                /* Reserved*/
  426.     UInt32                             ataReserved8;                /* Reserved*/
  427. };
  428. typedef struct ataBusInquiry            ataBusInquiry;
  429. /* Manager parameter block structure*/
  430.  
  431. struct ataMgrInquiry {
  432.                                                                 /* Start of cloned common header ataPBHdr*/
  433.     ataPBHeader *                    ataPBLink;                    /* a pointer to the next entry in the queue    */
  434.     UInt16                             ataPBQType;                    /* type byte for safety check*/
  435.     UInt8                             ataPBVers;                    /* -->: parameter block version number; Must be 0x01*/
  436.     UInt8                             ataPBReserved;                /* Reserved                                        */
  437.     Ptr                             ataPBReserved2;                /* Reserved                                        */
  438.     ProcPtr                         ataPBCallbackPtr;            /* -->: Completion Routine Pointer    */
  439.     OSErr                             ataPBResult;                /* <--: Returned result                */
  440.     UInt8                             ataPBFunctionCode;            /* -->: Manager Function Code */
  441.     UInt8                             ataPBIOSpeed;                /* -->: I/O Timing Class            */
  442.     UInt16                             ataPBFlags;                    /* -->: Various control options    */
  443.     SInt16                             ataPBReserved3;                /* Reserved                                        */
  444.     UInt32                             ataPBDeviceID;                /* -->: Device identifier            */
  445.     UInt32                             ataPBTimeOut;                /* -->: Transaction timeout value    in msec */
  446.     Ptr                             ataPBClientPtr1;            /* Client's storage Ptr 1     */
  447.     Ptr                             ataPBClientPtr2;            /* Client's storage Ptr 2     */
  448.     UInt16                             ataPBState;                    /* Reserved for Manager; Initialize to 0 */
  449.     UInt16                             ataPBSemaphores;            /* Used internally by the manager*/
  450.     SInt32                             ataPBReserved4;                /* Reserved                                        */
  451.                                                                 /* End of cloned common header ataPBHdr*/
  452.     NumVersion                         ataMgrVersion;                /* Manager Version information*/
  453.     UInt8                             ataMgrPBVers;                /* <--: Manager PB version number supported*/
  454.     UInt8                             Reserved1;                    /* Reserved*/
  455.     UInt16                             ataBusCnt;                    /* <--: Number of ATA buses in the system*/
  456.     UInt16                             ataDevCnt;                    /* <--: Total number of ATA devices detected*/
  457.     UInt8                             ataPioModes;                /* <--: Maximum Programmed I/O speed mode supported*/
  458.     UInt8                             Reserved2;                    /* Reserved*/
  459.     UInt16                             ataIOClkResolution;            /* <--: IO Clock resolution in nsec (Not supported)*/
  460.     UInt8                             ataSingleDMAModes;            /* <--: Single Word DMA modes supported    */
  461.     UInt8                             ataMultiDMAModes;            /* <--: Multiword DMA modes supported*/
  462.     SInt16                             Reserved[16];                /* Reserved for future expansion*/
  463. };
  464. typedef struct ataMgrInquiry            ataMgrInquiry;
  465. /* Parameter block structure for Abort command*/
  466. /* Manager parameter block structure*/
  467.  
  468. struct ataAbort {
  469.                                                                 /* Start of cloned common header ataPBHdr*/
  470.     ataPBHeader *                    ataPBLink;                    /* a pointer to the next entry in the queue    */
  471.     UInt16                             ataPBQType;                    /* type byte for safety check*/
  472.     UInt8                             ataPBVers;                    /* -->: parameter block version number; Must be 0x01*/
  473.     UInt8                             ataPBReserved;                /* Reserved                                        */
  474.     Ptr                             ataPBReserved2;                /* Reserved                                        */
  475.     ProcPtr                         ataPBCallbackPtr;            /* -->: Completion Routine Pointer    */
  476.     OSErr                             ataPBResult;                /* <--: Returned result                */
  477.     UInt8                             ataPBFunctionCode;            /* -->: Manager Function Code */
  478.     UInt8                             ataPBIOSpeed;                /* -->: I/O Timing Class            */
  479.     UInt16                             ataPBFlags;                    /* -->: Various control options    */
  480.     SInt16                             ataPBReserved3;                /* Reserved                                        */
  481.     UInt32                             ataPBDeviceID;                /* -->: Device identifier            */
  482.     UInt32                             ataPBTimeOut;                /* -->: Transaction timeout value    in msec */
  483.     Ptr                             ataPBClientPtr1;            /* Client's storage Ptr 1     */
  484.     Ptr                             ataPBClientPtr2;            /* Client's storage Ptr 2     */
  485.     UInt16                             ataPBState;                    /* Reserved for Manager; Initialize to 0 */
  486.     UInt16                             ataPBSemaphores;            /* Used internally by the manager*/
  487.     SInt32                             ataPBReserved4;                /* Reserved                                        */
  488.                                                                 /* End of cloned common header ataPBHdr*/
  489.     ataIOPB *                        ataAbortPB;                    /* -->: Parameter block to be aborted*/
  490.     SInt16                             Reserved[22];                /* Reserved for future expansion*/
  491. };
  492. typedef struct ataAbort                    ataAbort;
  493. /* Manager parameter block structure*/
  494.  
  495. struct ATAEventRec {
  496.     UInt16                             ataEventCode;                /* --> ATA event code*/
  497.     UInt16                             ataPhysicalID;                /* --> Physical drive reference*/
  498.     SInt32                             ataDrvrContext;                /* Context pointer saved by driver*/
  499.     UInt32                             ataMarker;                    /* Always 'LOAD'*/
  500.     UInt32                             ataEventRecVersion;            /* Version number of this data structure*/
  501.     UInt32                             ataDeviceType;                /* Device type on bus (valid for load driver only)*/
  502.     UInt16                             ataRefNum;                    /* RefNum of driver (valid for remove driver only)*/
  503. };
  504. typedef struct ATAEventRec                ATAEventRec;
  505. typedef ATAEventRec *                    ATAEventRecPtr;
  506. typedef CALLBACK_API( SInt16 , ATAClientProcPtr )(ATAEventRecPtr ataERPtr);
  507. typedef STACK_UPP_TYPE(ATAClientProcPtr)                         ATAClientUPP;
  508. enum { uppATAClientProcInfo = 0x000000E0 };                     /* pascal 2_bytes Func(4_bytes) */
  509. #define NewATAClientProc(userRoutine)                             (ATAClientUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppATAClientProcInfo, GetCurrentArchitecture())
  510. #define CallATAClientProc(userRoutine, ataERPtr)                 CALL_ONE_PARAMETER_UPP((userRoutine), uppATAClientProcInfo, (ataERPtr))
  511. /* Parameter block structure for Driver Register command*/
  512. /* Manager parameter block structure*/
  513.  
  514. struct ataDrvrRegister {
  515.                                                                 /* Start of cloned common header ataPBHdr*/
  516.     ataPBHeader *                    ataPBLink;                    /* a pointer to the next entry in the queue    */
  517.     UInt16                             ataPBQType;                    /* type byte for safety check*/
  518.     UInt8                             ataPBVers;                    /* -->: parameter block version number; Must be 0x01*/
  519.     UInt8                             ataPBReserved;                /* Reserved                                        */
  520.     Ptr                             ataPBReserved2;                /* Reserved                                        */
  521.     ProcPtr                         ataPBCallbackPtr;            /* -->: Completion Routine Pointer    */
  522.     OSErr                             ataPBResult;                /* <--: Returned result                */
  523.     UInt8                             ataPBFunctionCode;            /* -->: Manager Function Code */
  524.     UInt8                             ataPBIOSpeed;                /* -->: I/O Timing Class            */
  525.     UInt16                             ataPBFlags;                    /* -->: Various control options    */
  526.     SInt16                             ataPBReserved3;                /* Reserved                                        */
  527.     UInt32                             ataPBDeviceID;                /* -->: Device identifier            */
  528.     UInt32                             ataPBTimeOut;                /* -->: Transaction timeout value    in msec */
  529.     Ptr                             ataPBClientPtr1;            /* Client's storage Ptr 1     */
  530.     Ptr                             ataPBClientPtr2;            /* Client's storage Ptr 2     */
  531.     UInt16                             ataPBState;                    /* Reserved for Manager; Initialize to 0 */
  532.     UInt16                             ataPBSemaphores;            /* Used internally by the manager*/
  533.     SInt32                             ataPBReserved4;                /* Reserved                                        */
  534.                                                                 /* End of cloned common header ataPBHdr*/
  535.     SInt16                             ataDrvrRefNum;                /* <->: Driver reference number*/
  536.     UInt16                             ataDrvrFlags;                /* -->: 1 = loader driver if ataPBDeviceID = -1 {PB2}*/
  537.     UInt16                             ataDeviceNextID;            /* <--: used to specified the next drive ID*/
  538.     SInt16                             ataDrvrLoadPriv;            /* Driver loader private storage*/
  539.     ATAClientUPP                     ataEventHandler;            /* <->: Pointer to ATA event callback routine {PB2}*/
  540.     SInt32                             ataDrvrContext;                /* <->: Context data saved by driver {PB2}*/
  541.     SInt32                             ataEventMask;                /* <->: Set to 1 for notification of event {PB2}*/
  542.     SInt16                             Reserved[14];                /* Reserved for future expansion - from [21] {PB2}*/
  543. };
  544. typedef struct ataDrvrRegister            ataDrvrRegister;
  545. /* Parameter block structure for Modify driver event mask command*/
  546.  
  547. struct ataModifyEventMask {
  548.                                                                 /* Start of cloned common header ataPBHdr*/
  549.     ataPBHeader *                    ataPBLink;                    /* a pointer to the next entry in the queue    */
  550.     UInt16                             ataPBQType;                    /* type byte for safety check*/
  551.     UInt8                             ataPBVers;                    /* -->: parameter block version number; Must be 0x01*/
  552.     UInt8                             ataPBReserved;                /* Reserved                                        */
  553.     Ptr                             ataPBReserved2;                /* Reserved                                        */
  554.     ProcPtr                         ataPBCallbackPtr;            /* -->: Completion Routine Pointer    */
  555.     OSErr                             ataPBResult;                /* <--: Returned result                */
  556.     UInt8                             ataPBFunctionCode;            /* -->: Manager Function Code */
  557.     UInt8                             ataPBIOSpeed;                /* -->: I/O Timing Class            */
  558.     UInt16                             ataPBFlags;                    /* -->: Various control options    */
  559.     SInt16                             ataPBReserved3;                /* Reserved                                        */
  560.     UInt32                             ataPBDeviceID;                /* -->: Device identifier            */
  561.     UInt32                             ataPBTimeOut;                /* -->: Transaction timeout value    in msec */
  562.     Ptr                             ataPBClientPtr1;            /* Client's storage Ptr 1     */
  563.     Ptr                             ataPBClientPtr2;            /* Client's storage Ptr 2     */
  564.     UInt16                             ataPBState;                    /* Reserved for Manager; Initialize to 0 */
  565.     UInt16                             ataPBSemaphores;            /* Used internally by the manager*/
  566.     SInt32                             ataPBReserved4;                /* Reserved                                        */
  567.                                                                 /* End of cloned common header ataPBHdr*/
  568.     SInt32                             ataModifiedEventMask;        /* -->: new event mask value*/
  569.     SInt16                             Reserved[22];                /* Reserved for future expansion*/
  570. };
  571. typedef struct ataModifyEventMask        ataModifyEventMask;
  572. /* 'ataRegMask' field of the ataRegAccess definition*/
  573.  
  574. enum {
  575.     bATAAltSDevCValid            = 14,                            /* bit number of alternate status/device cntrl valid bit*/
  576.     bATAStatusCmdValid            = 7,                            /* bit number of status/command valid bit*/
  577.     bATASDHValid                = 6,                            /* bit number of ataTFSDH valid bit*/
  578.     bATACylinderHiValid            = 5,                            /* bit number of cylinder high valid bit*/
  579.     bATACylinderLoValid            = 4,                            /* bit number of cylinder low valid bit*/
  580.     bATASectorNumValid            = 3,                            /* bit number of sector number valid bit*/
  581.     bATASectorCntValid            = 2,                            /* bit number of sector count valid bit*/
  582.     bATAErrFeaturesValid        = 1,                            /* bit number of error/features valid bit*/
  583.     bATADataValid                = 0,                            /* bit number of data valid bit*/
  584.     mATAAltSDevCValid            = 1 << bATAAltSDevCValid,        /* alternate status/device control valid*/
  585.     mATAStatusCmdValid            = 1 << bATAStatusCmdValid,        /* status/command valid*/
  586.     mATASDHValid                = 1 << bATASDHValid,            /* ataTFSDH valid*/
  587.     mATACylinderHiValid            = 1 << bATACylinderHiValid,        /* cylinder high valid*/
  588.     mATACylinderLoValid            = 1 << bATACylinderLoValid,        /* cylinder low valid*/
  589.     mATASectorNumValid            = 1 << bATASectorNumValid,        /* sector number valid*/
  590.     mATASectorCntValid            = 1 << bATASectorCntValid,        /* sector count valid*/
  591.     mATAErrFeaturesValid        = 1 << bATAErrFeaturesValid,    /* error/features valid*/
  592.     mATADataValid                = 1 << bATADataValid            /* data valid*/
  593. };
  594.  
  595. /* Parameter block structure for device register access command*/
  596.  
  597. union ataRegValueUnion {
  598.     UInt8                             ataByteRegValue;            /* <->: Byte register value read or to be written*/
  599.     UInt16                             ataWordRegValue;            /* <->: Word register value read or to be written*/
  600. };
  601. typedef union ataRegValueUnion            ataRegValueUnion;
  602. /* Manager parameter block structure*/
  603.  
  604. struct ataRegAccess {
  605.                                                                 /* Start of cloned common header ataPBHdr*/
  606.     ataPBHeader *                    ataPBLink;                    /* a pointer to the next entry in the queue    */
  607.     UInt16                             ataPBQType;                    /* type byte for safety check*/
  608.     UInt8                             ataPBVers;                    /* -->: parameter block version number; Must be 0x01*/
  609.     UInt8                             ataPBReserved;                /* Reserved                                        */
  610.     Ptr                             ataPBReserved2;                /* Reserved                                        */
  611.     ProcPtr                         ataPBCallbackPtr;            /* -->: Completion Routine Pointer    */
  612.     OSErr                             ataPBResult;                /* <--: Returned result                */
  613.     UInt8                             ataPBFunctionCode;            /* -->: Manager Function Code */
  614.     UInt8                             ataPBIOSpeed;                /* -->: I/O Timing Class            */
  615.     UInt16                             ataPBFlags;                    /* -->: Various control options    */
  616.     SInt16                             ataPBReserved3;                /* Reserved                                        */
  617.     UInt32                             ataPBDeviceID;                /* -->: Device identifier            */
  618.     UInt32                             ataPBTimeOut;                /* -->: Transaction timeout value    in msec */
  619.     Ptr                             ataPBClientPtr1;            /* Client's storage Ptr 1     */
  620.     Ptr                             ataPBClientPtr2;            /* Client's storage Ptr 2     */
  621.     UInt16                             ataPBState;                    /* Reserved for Manager; Initialize to 0 */
  622.     UInt16                             ataPBSemaphores;            /* Used internally by the manager*/
  623.     SInt32                             ataPBReserved4;                /* Reserved                                        */
  624.                                                                 /* End of cloned common header ataPBHdr*/
  625.     UInt16                             ataRegSelect;                /* -->: Device Register Selector*/
  626.                                                                 /*            DataReg            0    */
  627.                                                                 /*            ErrorReg(R) or FeaturesReg(W)    1*/
  628.                                                                 /*            SecCntReg        2*/
  629.                                                                 /*            SecNumReg        3*/
  630.                                                                 /*            CylLoReg        4*/
  631.                                                                 /*            CylHiReg        5*/
  632.                                                                 /*            SDHReg            6*/
  633.                                                                 /*            StatusReg(R) or CmdReg(W)        7*/
  634.                                                                 /*            AltStatus(R) or DevCntr(W)    0E*/
  635.     ataRegValueUnion                 ataRegValue;
  636.                                                                 /* Following fields are valid only if ataRegSelect = 0xFFFF*/
  637.     UInt16                             ataRegMask;                    /* -->: mask for register(s) to update*/
  638.                                                                 /*        bit 0 : data register valid*/
  639.                                                                 /*        bit 1 : error/feaures register valid*/
  640.                                                                 /*        bit 2 : sector count register valid*/
  641.                                                                 /*        bit 3 : sector number register valid*/
  642.                                                                 /*        bit 4 : cylinder low register valid*/
  643.                                                                 /*        bit 5 : cylinder high register valid*/
  644.                                                                 /*        bit 6 : ataTFSDH register valid*/
  645.                                                                 /*        bit 7 : status/command register valid*/
  646.                                                                 /*        bits 8 - 13 : reserved (set to 0)*/
  647.                                                                 /*        bit 14: alternate status / device control reg valid*/
  648.                                                                 /*         bit 15: reserved (set to 0)*/
  649.     ataTaskFile                     ataRegisterImage;            /* <->: register images*/
  650.     UInt8                             ataAltSDevCReg;                /* <->: Alternate status(R) or Device Control(W) register image*/
  651.     UInt8                             Reserved3;                    /* Reserved*/
  652.     SInt16                             Reserved[16];                /* Reserved for future expansion*/
  653. };
  654. typedef struct ataRegAccess                ataRegAccess;
  655. /* Manager parameter block structure    <DP03/10/94>*/
  656.  
  657. struct ataIdentify {
  658.                                                                 /* Start of cloned common header ataPBHdr*/
  659.     ataPBHeader *                    ataPBLink;                    /* a pointer to the next entry in the queue    */
  660.     UInt16                             ataPBQType;                    /* type byte for safety check*/
  661.     UInt8                             ataPBVers;                    /* -->: parameter block version number; Must be 0x01*/
  662.     UInt8                             ataPBReserved;                /* Reserved                                        */
  663.     Ptr                             ataPBReserved2;                /* Reserved                                        */
  664.     ProcPtr                         ataPBCallbackPtr;            /* -->: Completion Routine Pointer    */
  665.     OSErr                             ataPBResult;                /* <--: Returned result                */
  666.     UInt8                             ataPBFunctionCode;            /* -->: Manager Function Code */
  667.     UInt8                             ataPBIOSpeed;                /* -->: I/O Timing Class            */
  668.     UInt16                             ataPBFlags;                    /* -->: Various control options    */
  669.     SInt16                             ataPBReserved3;                /* Reserved                                        */
  670.     UInt32                             ataPBDeviceID;                /* -->: Device identifier            */
  671.     UInt32                             ataPBTimeOut;                /* -->: Transaction timeout value    in msec */
  672.     Ptr                             ataPBClientPtr1;            /* Client's storage Ptr 1     */
  673.     Ptr                             ataPBClientPtr2;            /* Client's storage Ptr 2     */
  674.     UInt16                             ataPBState;                    /* Reserved for Manager; Initialize to 0 */
  675.     UInt16                             ataPBSemaphores;            /* Used internally by the manager*/
  676.     SInt32                             ataPBReserved4;                /* Reserved                                        */
  677.                                                                 /* End of cloned common header ataPBHdr*/
  678.     UInt16                             Reserved1[4];                /* Reserved.  These are used internally by the Manager*/
  679.     UInt8 *                            ataPBBuffer;                /* Buffer for the identify data (512 bytes)*/
  680.     UInt16                             Reserved2[12];                /* Used internally by the ATA Manager*/
  681.     SInt16                             Reserved3[6];                /* Reserved for future expansion*/
  682. };
  683. typedef struct ataIdentify                ataIdentify;
  684. /* 'ataConfigSetting' field of the Get/Set Device Configuration definition <8/6/94>*/
  685.  
  686. enum {
  687.     ATAPIpacketDRQ_bit            = 6,                            /* bit number of ATAPI command packet DRQ option*/
  688.     ATAPIpacketDRQ                = 1 << ATAPIpacketDRQ_bit        /* ATAPI command packet DRQ option*/
  689. };
  690.  
  691. /* atapcValid field definition*/
  692.  
  693. enum {
  694.     bATApcAccessMode            = 0,
  695.     bATApcVcc                    = 1,
  696.     bATApcVpp1                    = 2,
  697.     bATApcVpp2                    = 3,
  698.     bATApcStatus                = 4,
  699.     bATApcPin                    = 5,
  700.     bATApcCopy                    = 6,
  701.     bATApcConfigIndex            = 7,
  702.     bATApcLockUnlock            = 15,
  703.     mATApcAccessMode            = 1 << bATApcAccessMode,
  704.     mATApcVcc                    = 1 << bATApcVcc,
  705.     mATApcVpp1                    = 1 << bATApcVpp1,
  706.     mATApcVpp2                    = 1 << bATApcVpp2,
  707.     mATApcStatus                = 1 << bATApcStatus,
  708.     mATApcPin                    = 1 << bATApcPin,
  709.     mATApcCopy                    = 1 << bATApcCopy,
  710.     mATApcConfigIndex            = 1 << bATApcConfigIndex,
  711.     mATApcLockUnlock            = 1 << bATApcLockUnlock
  712. };
  713.  
  714. /* Device physical type & socket type indicator definition*/
  715.  
  716. enum {
  717.     kATADeviceUnknown            = 0x00,                            /* no device or type undetermined*/
  718.     kATADeviceATA                = 0x01,                            /* traditional ATA protocol device <7/29/94>*/
  719.     kATADeviceATAPI                = 0x02,                            /* ATAPI protocol device    <7/29/94>*/
  720.     kATADeviceReserved            = 0x03                            /* reserved by Apple (was PCMCIA)*/
  721. };
  722.  
  723.  
  724. enum {
  725.     kATASocketInternal            = 0x01,                            /* Internal ATA socket*/
  726.     kATASocketMB                = 0x02,                            /* Media Bay socket*/
  727.     kATASocketPCMCIA            = 0x03                            /* PCMCIA socket*/
  728. };
  729.  
  730. /* reserved words at the end of the devConfig structure*/
  731.  
  732. enum {
  733.     kATAConfigReserved            = 5                                /* number of reserved words at the end*/
  734. };
  735.  
  736. /*
  737.    Get/Set Device Configuration parameter block structure <8/6/94>
  738.    Manager parameter block structure
  739. */
  740.  
  741. struct ataDevConfiguration {
  742.                                                                 /* Start of cloned common header ataPBHdr*/
  743.     ataPBHeader *                    ataPBLink;                    /* a pointer to the next entry in the queue    */
  744.     UInt16                             ataPBQType;                    /* type byte for safety check*/
  745.     UInt8                             ataPBVers;                    /* -->: parameter block version number; Must be 0x01*/
  746.     UInt8                             ataPBReserved;                /* Reserved                                        */
  747.     Ptr                             ataPBReserved2;                /* Reserved                                        */
  748.     ProcPtr                         ataPBCallbackPtr;            /* -->: Completion Routine Pointer    */
  749.     OSErr                             ataPBResult;                /* <--: Returned result                */
  750.     UInt8                             ataPBFunctionCode;            /* -->: Manager Function Code */
  751.     UInt8                             ataPBIOSpeed;                /* -->: I/O Timing Class            */
  752.     UInt16                             ataPBFlags;                    /* -->: Various control options    */
  753.     SInt16                             ataPBReserved3;                /* Reserved                                        */
  754.     UInt32                             ataPBDeviceID;                /* -->: Device identifier            */
  755.     UInt32                             ataPBTimeOut;                /* -->: Transaction timeout value    in msec */
  756.     Ptr                             ataPBClientPtr1;            /* Client's storage Ptr 1     */
  757.     Ptr                             ataPBClientPtr2;            /* Client's storage Ptr 2     */
  758.     UInt16                             ataPBState;                    /* Reserved for Manager; Initialize to 0 */
  759.     UInt16                             ataPBSemaphores;            /* Used internally by the manager*/
  760.     SInt32                             ataPBReserved4;                /* Reserved                                        */
  761.                                                                 /* End of cloned common header ataPBHdr*/
  762.     SInt32                             ataConfigSetting;            /* <->: Configuration setting*/
  763.                                                                 /*      Bits 3 - 0: Reserved*/
  764.                                                                 /*      Bit 4: Reserved (allowLBAAccess)*/
  765.                                                                 /*      Bit 5: Reserved (allowRWMultiple)*/
  766.                                                                 /*      Bit 6: ATAPIpacketDRQ*/
  767.                                                                 /*        1 = Check for Interrupt DRQ on ATAPI command packet DRQ*/
  768.                                                                 /*        0 = Default: Check only for the assertion of command packet DRQ*/
  769.                                                                 /*      Bits 31 - 7: Reserved*/
  770.     UInt8                             ataPIOSpeedMode;            /* <->: Device access speed in PIO Mode*/
  771.     UInt8                             Reserved3;                    /* Reserved to force word alignment*/
  772.     UInt16                             atapcValid;                    /* <->: Set when pcXXX fields are valid (atapcAccessMode - atapcConfigIndex)*/
  773.                                                                 /*        bit 0 - atapcAccessMode field valid, when set*/
  774.                                                                 /*        bit 1 - atapcVcc field valid, when set*/
  775.                                                                 /*        bit 2 - atapcVpp1 field valid, when set*/
  776.                                                                 /*        bit 3 - atapcVpp2 field valid, when set*/
  777.                                                                 /*        bit 4 - atapcStatus field valid, when set*/
  778.                                                                 /*        bit 5 - atapcPin field valid, when set*/
  779.                                                                 /*        bit 6 - atapcCopy field valid, when set*/
  780.                                                                 /*        bit 7 - atapcConfigIndex field valid, when set*/
  781.                                                                 /*        bits 14-8 - Reserved*/
  782.                                                                 /*        bit 15 - device lock/unlock request (write only)*/
  783.     UInt16                             ataRWMultipleCount;            /* Reserved for future (not supported yet)*/
  784.     UInt16                             ataSectorsPerCylinder;        /* Reserved for future (not supported yet)*/
  785.     UInt16                             ataHeads;                    /* Reserved for future (not supported yet)*/
  786.     UInt16                             ataSectorsPerTrack;            /* Reserved for future (not supported yet)*/
  787.     UInt16                             ataSocketNumber;            /* <--: Socket number used by the CardServices*/
  788.                                                                 /*        0xFF = socket number invalid (Not a CardServices device)*/
  789.                                                                 /*        other = socket number of the device*/
  790.     UInt8                             ataSocketType;                /* <--: Specifies the socket type (get config only)*/
  791.                                                                 /*        00 = Unknown socket*/
  792.                                                                 /*         01 = Internal ATA bus*/
  793.                                                                 /*        02 = Media Bay*/
  794.                                                                 /*        03 = PCMCIA*/
  795.     UInt8                             ataDeviceType;                /* <--: Specifies the device type (get config only)*/
  796.                                                                 /*        00 = Unknown device*/
  797.                                                                 /*        01 = standard ATA device (HD)*/
  798.                                                                 /*        02 = ATAPI device*/
  799.                                                                 /*        03 = PCMCIA ATA device*/
  800.     UInt8                             atapcAccessMode;            /* <->: Access mode: Memory vs. I/O (PCMCIA only)*/
  801.     UInt8                             atapcVcc;                    /* <->: Voltage in tenths of a volt (PCMCIA only)*/
  802.     UInt8                             atapcVpp1;                    /* <->: Voltage in tenths of a volt (PCMCIA only)*/
  803.     UInt8                             atapcVpp2;                    /* <->: Voltage in tenths of a volt (PCMCIA only)*/
  804.     UInt8                             atapcStatus;                /* <->: Card Status register setting (PCMCIA only)*/
  805.     UInt8                             atapcPin;                    /* <->: Card Pin register setting (PCMCIA only)*/
  806.     UInt8                             atapcCopy;                    /* <->: Card Socket/Copy register setting (PCMCIA only)*/
  807.     UInt8                             atapcConfigIndex;            /* <->: Card Option register setting (PCMCIA only)*/
  808.     UInt8                             ataSingleDMASpeed;            /* <->: Single Word DMA Timing Class*/
  809.     UInt8                             ataMultiDMASpeed;            /* <->: Multiple Word DMA Timing Class*/
  810.     UInt16                             ataPIOCycleTime;            /* <->:Cycle time for PIO mode*/
  811.     UInt16                             ataMultiCycleTime;            /* <->:Cycle time for Multiword DMA mode*/
  812.     UInt8                             ataUltraDMASpeed;            /* <-> Ultra DMA timing class*/
  813.     UInt8                             reserved2;                    /* reserved*/
  814.     UInt16                             ataUltraCycleTime;            /* <-> Cycle time for Ultra DMA mode*/
  815.     UInt16                             Reserved1[5];                /* Reserved for future*/
  816. };
  817. typedef struct ataDevConfiguration        ataDevConfiguration;
  818. /* Get Card Location Icon/Text    <SM4>*/
  819.  
  820. enum {
  821.     kATALargeIconHFS            = 0x0001,                        /* Large B&W icon with mask (HFS)*/
  822.     kATALargeIconProDOS            = 0x0081                        /* Large B&W icon with mask (ProDOS)*/
  823. };
  824.  
  825. /* Manager parameter block structure*/
  826.  
  827. struct ataLocationData {
  828.                                                                 /* Start of cloned common header ataPBHdr*/
  829.     ataPBHeader *                    ataPBLink;                    /* a pointer to the next entry in the queue    */
  830.     UInt16                             ataPBQType;                    /* type byte for safety check*/
  831.     UInt8                             ataPBVers;                    /* -->: parameter block version number; Must be 0x01*/
  832.     UInt8                             ataPBReserved;                /* Reserved                                        */
  833.     Ptr                             ataPBReserved2;                /* Reserved                                        */
  834.     ProcPtr                         ataPBCallbackPtr;            /* -->: Completion Routine Pointer    */
  835.     OSErr                             ataPBResult;                /* <--: Returned result                */
  836.     UInt8                             ataPBFunctionCode;            /* -->: Manager Function Code */
  837.     UInt8                             ataPBIOSpeed;                /* -->: I/O Timing Class            */
  838.     UInt16                             ataPBFlags;                    /* -->: Various control options    */
  839.     SInt16                             ataPBReserved3;                /* Reserved                                        */
  840.     UInt32                             ataPBDeviceID;                /* -->: Device identifier            */
  841.     UInt32                             ataPBTimeOut;                /* -->: Transaction timeout value    in msec */
  842.     Ptr                             ataPBClientPtr1;            /* Client's storage Ptr 1     */
  843.     Ptr                             ataPBClientPtr2;            /* Client's storage Ptr 2     */
  844.     UInt16                             ataPBState;                    /* Reserved for Manager; Initialize to 0 */
  845.     UInt16                             ataPBSemaphores;            /* Used internally by the manager*/
  846.     SInt32                             ataPBReserved4;                /* Reserved                                        */
  847.                                                                 /* End of cloned common header ataPBHdr*/
  848.     SInt16                             ataIconType;                /* -->: icon type specifier*/
  849.                                                                 /*         1 = Large B&W icon with mask (256 bytes)*/
  850.                                                                 /*        0x81 = Same as 1, but ProDOS icon*/
  851.     SInt16                             ataIconReserved;            /* Reserved to be longword aligned*/
  852.     SInt8 *                            ataLocationIconPtr;            /* -->: Icon Data buffer pointer*/
  853.     SInt8 *                            ataLocationStringPtr;        /* -->: Icon String buffer pointer*/
  854.     UInt16                             Reserved1[18];                /* Reserved for future*/
  855. };
  856. typedef struct ataLocationData            ataLocationData;
  857. /* ataOSType available*/
  858.  
  859. enum {
  860.     kATAddTypeMacOS                = 0x0001                        /* Blue Mac O/S ddType value*/
  861. };
  862.  
  863. /* The parameter block definition for all other ATA Manager functions.*/
  864.  
  865.  
  866. struct ataGeneric {
  867.                                                                 /* Start of cloned common header ataPBHdr*/
  868.     ataPBHeader *                    ataPBLink;                    /* a pointer to the next entry in the queue    */
  869.     UInt16                             ataPBQType;                    /* type byte for safety check*/
  870.     UInt8                             ataPBVers;                    /* -->: parameter block version number; Must be 0x01*/
  871.     UInt8                             ataPBReserved;                /* Reserved                                        */
  872.     Ptr                             ataPBReserved2;                /* Reserved                                        */
  873.     ProcPtr                         ataPBCallbackPtr;            /* -->: Completion Routine Pointer    */
  874.     OSErr                             ataPBResult;                /* <--: Returned result                */
  875.     UInt8                             ataPBFunctionCode;            /* -->: Manager Function Code */
  876.     UInt8                             ataPBIOSpeed;                /* -->: I/O Timing Class            */
  877.     UInt16                             ataPBFlags;                    /* -->: Various control options    */
  878.     SInt16                             ataPBReserved3;                /* Reserved                                        */
  879.     UInt32                             ataPBDeviceID;                /* -->: Device identifier            */
  880.     UInt32                             ataPBTimeOut;                /* -->: Transaction timeout value    in msec */
  881.     Ptr                             ataPBClientPtr1;            /* Client's storage Ptr 1     */
  882.     Ptr                             ataPBClientPtr2;            /* Client's storage Ptr 2     */
  883.     UInt16                             ataPBState;                    /* Reserved for Manager; Initialize to 0 */
  884.     UInt16                             ataPBSemaphores;            /* Used internally by the manager*/
  885.     SInt32                             ataPBReserved4;                /* Reserved                                        */
  886.                                                                 /* End of cloned common header ataPBHdr*/
  887.     UInt16                             Reserved[24];                /* Reserved for future*/
  888. };
  889. typedef struct ataGeneric                ataGeneric;
  890.  
  891. union ataPB {
  892.     ataIOPB                         ataIOParamBlock;            /* parameter block for I/O*/
  893.     ataBusInquiry                     ataBIParamBlock;            /* parameter block for bus inquiry*/
  894.     ataMgrInquiry                     ataMIParamBlock;            /* parameter block for Manager inquiry*/
  895.     ataAbort                         ataAbortParamBlock;            /* parameter block for abort*/
  896.     ataDrvrRegister                 ataDRParamBlock;            /* parameter block for driver register*/
  897.     ataModifyEventMask                 ataMEParamBlock;            /* parameter block for event mask modify*/
  898.     ataRegAccess                     ataRAParamBlock;            /* parameter block for register access*/
  899.     ataIdentify                     ataDIParamBlock;            /* parameter block for drive identify*/
  900.     ataDevConfiguration             ataDCParamBlock;            /* parameter block for device configuration*/
  901.     ataLocationData                 ataLDParamBlock;            /* parameter block for location icon data*/
  902.                                                                 /*ataManagerInit    ataInitParamBlock;        // parameter block for Manager initialization*/
  903.                                                                 /*ataManagerShutDn    ataSDParamBlock;        // parameter block for Manager shutdown*/
  904.                                                                 /*ataDrvrLoad        ataDLParamBlock;        // parameter block for Driver loading*/
  905.     ataGeneric                         ataGenericParamBlock;        /* parameter block for all other functions*/
  906. };
  907. typedef union ataPB                        ataPB;
  908. /* The ATA Event codes…*/
  909.  
  910. enum {
  911.     kATANullEvent                = 0x00,                            /* Just kidding -- nothing happened*/
  912.     kATAOnlineEvent                = 0x01,                            /* An ATA device has come online*/
  913.     kATAOfflineEvent            = 0x02,                            /* An ATA device has gone offline*/
  914.     kATARemovedEvent            = 0x03,                            /* An ATA device has been removed from the bus*/
  915.     kATAResetEvent                = 0x04,                            /* Someone gave a hard reset to the drive*/
  916.     kATAOfflineRequest            = 0x05,                            /* Someone requesting to offline the drive*/
  917.     kATAEjectRequest            = 0x06,                            /* Someone requesting to eject the drive*/
  918.     kATAUpdateEvent                = 0x07,                            /* Potential configuration change reported by CardServices <SM4>*/
  919.     kATATaskTimeRequest            = 0x08,                            /* The manager is requesting to be called at Task Time*/
  920.     kATALoadDriverNow            = 0x09,                            /* Load the driver for the given bus immediately*/
  921.     kATAPIResetEvent            = 0x0A,                            /* Someone gave a ATAPI reset to the drive*/
  922.                                                                 /* The following describes bit definitions in the eventMask field of ataDrvrRegister*/
  923.     bATANullEvent                = 1 << kATANullEvent,            /* null event bit*/
  924.     bATAOnlineEvent                = 1 << kATAOnlineEvent,            /* online event bit*/
  925.     bATAOfflineEvent            = 1 << kATAOfflineEvent,        /* offline event bit*/
  926.     bATARemovedEvent            = 1 << kATARemovedEvent,        /* removed event bit*/
  927.     bATAResetEvent                = 1 << kATAResetEvent,            /* ATA reset event bit*/
  928.     bATAOfflineRequest            = 1 << kATAOfflineRequest,        /* offline request event bit*/
  929.     bATAEjectRequest            = 1 << kATAEjectRequest,        /* eject request event bit*/
  930.     bATAUpdateEvent                = 1 << kATAUpdateEvent,            /* configuration update event bit*/
  931.     bATAPIResetEvent            = 1 << kATAPIResetEvent            /* ATAPI reset event bit*/
  932. };
  933.  
  934.  
  935. enum {
  936.     kATAEventMarker                = FOUR_CHAR_CODE('LOAD'),        /* Marker for the event data structure*/
  937.     kATAEventVersion1            = 0x00000001                    /* Version 1 of the event structure*/
  938. };
  939.  
  940. typedef CALLBACK_API( OSErr , ATADispatchProcPtr )(ataPB *pb);
  941. typedef STACK_UPP_TYPE(ATADispatchProcPtr)                         ATADispatchUPP;
  942. enum { uppATADispatchProcInfo = 0x000000E0 };                     /* pascal 2_bytes Func(4_bytes) */
  943. #define NewATADispatchProc(userRoutine)                         (ATADispatchUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppATADispatchProcInfo, GetCurrentArchitecture())
  944. #define CallATADispatchProc(userRoutine, pb)                     CALL_ONE_PARAMETER_UPP((userRoutine), uppATADispatchProcInfo, (pb))
  945. EXTERN_API( SInt16 )
  946. ataManager                        (ataPB *                pb)                                    ONEWORDINLINE(0xAAF1);
  947.  
  948. /* Device Error codes: 0xDB42 - 0xDB5F    */
  949.  
  950.  
  951. enum {
  952.     ATABaseErrCode                = -9406,                        /* Base error code - 0xDB42    */
  953.     ioPending                    = 1,                            /* Asynch I/O in progress status*/
  954.     AT_NRdyErr                    = ATABaseErrCode + 0x01,        /* 0xDB43: Drive not Ready */
  955.     AT_IDNFErr                    = ATABaseErrCode + 0x02,        /* 0xDB44: ID not found */
  956.     AT_DMarkErr                    = ATABaseErrCode + 0x03,        /* 0xDB45: Data mark not found */
  957.     AT_BadBlkErr                = ATABaseErrCode + 0x04,        /* 0xDB46: Bad Block */
  958.     AT_CorDataErr                = ATABaseErrCode + 0x05,        /* 0xDB47: Data was corrected */
  959.     AT_UncDataErr                = ATABaseErrCode + 0x06,        /* 0xDB48: Data was not corrected */
  960.     AT_SeekErr                    = ATABaseErrCode + 0x07,        /* 0xDB49: Seek error */
  961.     AT_WrFltErr                    = ATABaseErrCode + 0x08,        /* 0xDB4A: Write fault */
  962.     AT_RecalErr                    = ATABaseErrCode + 0x09,        /* 0xDB4B: Recalibrate failed */
  963.     AT_AbortErr                    = ATABaseErrCode + 0x0A,        /* 0xDB4C: Command aborted by drive */
  964.     AT_MCErr                    = ATABaseErrCode + 0x0C,        /* 0xDB4E: Media Changed error*/
  965.     ATAPICheckErr                = ATABaseErrCode + 0x0D,        /* 0xDB4F: ATAPI Check condition <06/15/94>*/
  966.                                                                 /* System error codes...Custom Driver Error Codes 0xDB60 - 0xDB6F*/
  967.     DRVRCantAllocate            = ATABaseErrCode + 0x1E,        /* 0xDB60: Allocation error during initialization*/
  968.     NoATAMgr                    = ATABaseErrCode + 0x1F,        /* 0xDB61: MgrInquiry failed => No ATA Manager*/
  969.     ATAInitFail                    = ATABaseErrCode + 0x20,        /* 0xDB62: Mgr Initialization failed*/
  970.     ATABufFail                    = ATABaseErrCode + 0x21,        /* 0xDB63: Device buffer test failure*/
  971.     ATADevUnsupported            = ATABaseErrCode + 0x22,        /* 0xDB64: Device type not supported*/
  972.     ATAEjectDrvErr                = ATABaseErrCode + 0x23,        /* 0xDB65: Could not eject the drive*/
  973.                                                                 /* Manager Error Codes 0xDB70 - 0xDB8F*/
  974.     ATAMgrNotInitialized        = ATABaseErrCode + 0x2E,        /* 0xDB70: Mgr has not been initialized*/
  975.     ATAPBInvalid                = ATABaseErrCode + 0x2F,        /* 0xDB71: The bus base address couldn't be found*/
  976.     ATAFuncNotSupported            = ATABaseErrCode + 0x30,        /* 0xDB72: An unknown function code specified*/
  977.     ATABusy                        = ATABaseErrCode + 0x31,        /* 0xDB73: Selected device is busy*/
  978.     ATATransTimeOut                = ATABaseErrCode + 0x32,        /* 0xDB74: Transaction timeout detected*/
  979.     ATAReqInProg                = ATABaseErrCode + 0x33,        /* 0xDB75: Channel busy; channel is processing another cmd*/
  980.     ATAUnknownState                = ATABaseErrCode + 0x34,        /* 0xDB76: Device status register reflects an unknown state*/
  981.     ATAQLocked                    = ATABaseErrCode + 0x35,        /* 0xDB77: I/O Queue is locked due to previous I/O error.*/
  982.     ATAReqAborted                = ATABaseErrCode + 0x36,        /* 0xDB78: The I/O queue entry was aborted due to an abort req.*/
  983.                                                                 /*            or due to Manager shutdown.*/
  984.     ATAUnableToAbort            = ATABaseErrCode + 0x37,        /* 0xDB79: The I/O queue entry could not be aborted.*/
  985.     ATAAbortedDueToRst            = ATABaseErrCode + 0x38,        /* 0xDB7A: Request aborted due to a device reset command.*/
  986.     ATAPIPhaseErr                = ATABaseErrCode + 0x39,        /* 0xDB7B: Unexpected phase - •••IS THIS VALID ERROR??? <06/15/94>*/
  987.     ATAPITxCntErr                = ATABaseErrCode + 0x3A,        /* 0xDB7C: Overrun/Underrun condition detected*/
  988.     ATANoClientErr                = ATABaseErrCode + 0x3B,        /* 0xDB7D: No client present to handle the event*/
  989.     ATAInternalErr                = ATABaseErrCode + 0x3C,        /* 0xDB7E: MagnumOpus returned an error*/
  990.     ATABusErr                    = ATABaseErrCode + 0x3D,        /* 0xDB7F: Bus error detected on I/O    */
  991.     AT_NoAddrErr                = ATABaseErrCode + 0x3E,        /* 0xDB80: Invalid AT base adress */
  992.     DriverLocked                = ATABaseErrCode + 0x3F,        /* 0xDB81: Current driver must be removed before adding another*/
  993.     CantHandleEvent                = ATABaseErrCode + 0x40,        /* 0xDB82: Particular event couldn't be handled (call others)*/
  994.     ATAMgrMemoryErr                = ATABaseErrCode + 0x41,        /* 0xDB83: Manager memory allocation error    */
  995.     ATASDFailErr                = ATABaseErrCode + 0x42,        /* 0xDB84: Shutdown failure                */
  996.     ATAXferParamErr                = ATABaseErrCode + 0x43,        /* 0xDB85: I/O xfer parameters inconsistent */
  997.     ATAXferModeErr                = ATABaseErrCode + 0x44,        /* 0xDB86: I/O xfer mode not supported */
  998.     ATAMgrConsistencyErr        = ATABaseErrCode + 0x45,        /* 0XDB87: Manager detected internal inconsistency. */
  999.     ATADmaXferErr                = ATABaseErrCode + 0x46,        /* 0XDB88: fatal error in DMA side of transfer */
  1000.                                                                 /* Driver loader error Codes 0xDB90 - 0xDBA5*/
  1001.     ATAInvalidDrvNum            = ATABaseErrCode + 0x4E,        /* 0xDB90: Invalid drive number from event*/
  1002.     ATAMemoryErr                = ATABaseErrCode + 0x4F,        /* 0xDB91: Memory allocation error*/
  1003.     ATANoDDMErr                    = ATABaseErrCode + 0x50,        /* 0xDB92: No DDM found on media    */
  1004.     ATANoDriverErr                = ATABaseErrCode + 0x51            /* 0xDB93: No driver found on the media    */
  1005. };
  1006.  
  1007. /* ------------------------    Version 1 definition -------------------------------    */
  1008.  
  1009. enum {
  1010.     v1ATABaseErrCode            = 0x0700,                        /* This needs a home somewhere*/
  1011.     v1AT_NRdyErr                = 0x01 - v1ATABaseErrCode,        /* 0xF901: -0x1DBE */
  1012.     v1AT_IDNFErr                = 0x04 - v1ATABaseErrCode,        /* 0xF904: -0x1DC0 */
  1013.     v1AT_DMarkErr                = 0x05 - v1ATABaseErrCode,        /* 0xF905: -0x1DC0 */
  1014.     v1AT_BadBlkErr                = 0x06 - v1ATABaseErrCode,        /* 0xF906: -0x1DC0 */
  1015.     v1AT_CorDataErr                = 0x07 - v1ATABaseErrCode,        /* 0xF907: -0x1DC0 */
  1016.     v1AT_UncDataErr                = 0x08 - v1ATABaseErrCode,        /* 0xF908: -0x1DC0 */
  1017.     v1AT_SeekErr                = 0x09 - v1ATABaseErrCode,        /* 0xF909: -0x1DC0 */
  1018.     v1AT_WrFltErr                = 0x0A - v1ATABaseErrCode,        /* 0xF90A: -0x1DC0 */
  1019.     v1AT_RecalErr                = 0x0B - v1ATABaseErrCode,        /* 0xF90B: -0x1DC0 */
  1020.     v1AT_AbortErr                = 0x0C - v1ATABaseErrCode,        /* 0xF90C: -0x1DC0 */
  1021.     v1AT_NoAddrErr                = 0x0D - v1ATABaseErrCode,        /* 0xF90D: -0x1D8D */
  1022.     v1AT_MCErr                    = 0x0E - v1ATABaseErrCode,        /* 0xF90E: -0x1DC0*/
  1023.                                                                 /* System error codes...Custom Driver Error Codes*/
  1024.     v1DRVRCantAllocate            = -(v1ATABaseErrCode + 1),        /* 0xF8FF: -0x1D9F*/
  1025.     v1NoATAMgr                    = -(v1ATABaseErrCode + 2),        /* 0xF8FE: -0x1D9D*/
  1026.     v1ATAInitFail                = -(v1ATABaseErrCode + 3),        /* 0xF8FD: -0x1D9B*/
  1027.     v1ATABufFail                = -(v1ATABaseErrCode + 4),        /* 0xF8FC: -0x1D99*/
  1028.     v1ATADevUnsupported            = -(v1ATABaseErrCode + 5),        /* 0xF8FB: -0x1c97*/
  1029.                                                                 /* Manager Error Codes*/
  1030.     v1ATAMgrNotInitialized        = -(v1ATABaseErrCode + 10),        /* 0xF8F6: -0x1D86*/
  1031.     v1ATAPBInvalid                = -(v1ATABaseErrCode + 11),        /* 0xF8F5: -0x1D84*/
  1032.     v1ATAFuncNotSupported        = -(v1ATABaseErrCode + 12),        /* 0xF8F4: -0x1D82*/
  1033.     v1ATABusy                    = -(v1ATABaseErrCode + 13),        /* 0xF8F3: -0x1D80*/
  1034.     v1ATATransTimeOut            = -(v1ATABaseErrCode + 14),        /* 0xF8F2: -0x1D7E*/
  1035.     v1ATAReqInProg                = -(v1ATABaseErrCode + 15),        /* 0xF8F1: -0x1D7C*/
  1036.     v1ATAUnknownState            = -(v1ATABaseErrCode + 16),        /* 0xF8F0: -0x1D7A*/
  1037.     v1ATAQLocked                = -(v1ATABaseErrCode + 17),        /* 0xF8EF: -0x1D78*/
  1038.     v1ATAReqAborted                = -(v1ATABaseErrCode + 18),        /* 0xF8EE: -0x1D76*/
  1039.     v1ATAUnableToAbort            = -(v1ATABaseErrCode + 19),        /* 0xF8ED: -0x1D74*/
  1040.     v1ATAAbortedDueToRst        = -(v1ATABaseErrCode + 20)        /* 0xF8EC: -0x1D72*/
  1041. };
  1042.  
  1043.  
  1044.  
  1045. #if PRAGMA_STRUCT_ALIGN
  1046.     #pragma options align=reset
  1047. #elif PRAGMA_STRUCT_PACKPUSH
  1048.     #pragma pack(pop)
  1049. #elif PRAGMA_STRUCT_PACK
  1050.     #pragma pack()
  1051. #endif
  1052.  
  1053. #ifdef PRAGMA_IMPORT_OFF
  1054. #pragma import off
  1055. #elif PRAGMA_IMPORT
  1056. #pragma import reset
  1057. #endif
  1058.  
  1059. #ifdef __cplusplus
  1060. }
  1061. #endif
  1062.  
  1063. #endif /* __ATA__ */
  1064.  
  1065.